package com.xumz.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.swing.JOptionPane;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.xumz.model.StudentManage;
import com.xumz.service.ClassService;
import com.xumz.service.StudentService;
import com.xumz.service.crawler.CrawlerService;

@Controller
public class CrawlerController {
	@Autowired
	StudentService studentService;
	@Autowired
	ClassService cms;
	@Autowired
	CrawlerService crawlerService;

	public CrawlerController() {
		System.out.println("CrawlerController");
	}

	@RequestMapping(value = "oneCrawler/{vo.stuId }",method=RequestMethod.GET)
	public String oneCrawler(HttpServletRequest request,Model model,@PathVariable("vo.stuId ") String stuId) {
		System.out.println("采集的id"+stuId.substring(0, stuId.length()-3));
		
		crawlerService.collectOneStudentBoke(stuId.substring(0, stuId.length()-3));
		
		String name=(String) request.getSession().getAttribute("name");
		//		JOptionPane.showMessageDialog(null, "采集成功");
		List<StudentManage> list = cms.selectAllStudentByTeacherName(name);
		model.addAttribute("list",list);
		return "teacher/admin/classgroup/index";
	}
}
